/*     */ package com.cr.system.service.impl;
/*     */ 
/*     */ import com.cr.common.core.domain.entity.SysDictData;
/*     */ import com.cr.common.core.text.Convert;
/*     */ import com.cr.common.utils.DictUtils;
/*     */ import com.cr.system.mapper.SysDictDataMapper;
/*     */ import com.cr.system.service.ISysDictDataService;
/*     */ import java.util.List;
/*     */ import org.springframework.beans.factory.annotation.Autowired;
/*     */ import org.springframework.stereotype.Service;
/*     */ 
/*     */ @Service
/*     */ public class SysDictDataServiceImpl implements ISysDictDataService {
/*     */   @Autowired
/*     */   private SysDictDataMapper dictDataMapper;
/*     */   
/*     */   public List<SysDictData> selectDictDataList(SysDictData dictData) {
/*  32 */     return this.dictDataMapper.selectDictDataList(dictData);
/*     */   }
/*     */   
/*     */   public String selectDictLabel(String dictType, String dictValue) {
/*  45 */     return this.dictDataMapper.selectDictLabel(dictType, dictValue);
/*     */   }
/*     */   
/*     */   public SysDictData selectDictDataById(Long dictCode) {
/*  57 */     return this.dictDataMapper.selectDictDataById(dictCode);
/*     */   }
/*     */   
/*     */   public void deleteDictDataByIds(String ids) {
/*  69 */     Long[] dictCodes = Convert.toLongArray(ids);
/*  70 */     for (Long dictCode : dictCodes) {
/*  72 */       SysDictData data = selectDictDataById(dictCode);
/*  73 */       this.dictDataMapper.deleteDictDataById(dictCode);
/*  74 */       List<SysDictData> dictDatas = this.dictDataMapper.selectDictDataByType(data.getDictType());
/*  75 */       DictUtils.setDictCache(data.getDictType(), dictDatas);
/*     */     } 
/*     */   }
/*     */   
/*     */   public int insertDictData(SysDictData data) {
/*  88 */     int row = this.dictDataMapper.insertDictData(data);
/*  89 */     if (row > 0) {
/*  91 */       List<SysDictData> dictDatas = this.dictDataMapper.selectDictDataByType(data.getDictType());
/*  92 */       DictUtils.setDictCache(data.getDictType(), dictDatas);
/*     */     } 
/*  94 */     return row;
/*     */   }
/*     */   
/*     */   public int updateDictData(SysDictData data) {
/* 106 */     int row = this.dictDataMapper.updateDictData(data);
/* 107 */     if (row > 0) {
/* 109 */       List<SysDictData> dictDatas = this.dictDataMapper.selectDictDataByType(data.getDictType());
/* 110 */       DictUtils.setDictCache(data.getDictType(), dictDatas);
/*     */     } 
/* 112 */     return row;
/*     */   }
/*     */ }


/* Location:              D:\tmp\creditorRights-admin\BOOT-INF\lib\creditorRights-system-4.7.0.jar!\com\cr\system\service\impl\SysDictDataServiceImpl.class
 * Java compiler version: 8 (52.0)
 * JD-Core Version:       1.1.3
 */